home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / CD CHIP.ISO / WebServ / server7 / bin / serverpush.dpr < prev    next >
Encoding:
Text File  |  1996-04-09  |  2.3 KB  |  55 lines

  1. library serverpush;
  2.  
  3. { Important note about DLL memory management: ShareMem must be the
  4.   first unit in your library's USES clause AND your project's (select
  5.   View-Project Source) USES clause if your DLL exports any procedures or
  6.   functions that pass strings as parameters or function results. This
  7.   applies to all strings passed to and from your DLL--even those that
  8.   are nested in records and classes. ShareMem is the interface unit to
  9.   the DELPHIMM.DLL shared memory manager, which must be deployed along
  10.   with your DLL. To avoid using DELPHIMM.DLL, pass string information
  11.   using PChar or ShortString parameters. }
  12.  
  13. uses
  14.   Windows, SysUtils, Classes, Httpext;
  15.  
  16.  
  17.  
  18. // CASE MATTERS FOR THIS FUNCTION NAME
  19. function GetExtensionVersion(var ver: THSE_VERSION_INFO): Boolean; stdcall;
  20. begin
  21.   result:=True;
  22. end;
  23.  
  24. // CASE MATTERS FOR THIS FUNCTION NAME
  25. function HttpExtensionProc(var ecb: TEXTENSION_CONTROL_BLOCK): LongInt; stdcall;
  26. var
  27.   FN_Write: TWriteClientProc;
  28.   s: String;
  29.   len: Integer;
  30. begin
  31.   // Get the callback function
  32.   @FN_Write:=@ecb.WriteClient;
  33.  
  34.   s:='HTTP/1.0 200'#13#10;                                                                len:=Length(s); FN_WRITE(ecb.ConnID, PChar(s), len, 0);
  35.   s:='Content-type: multipart/x-mixed-replace;boundary=--TERM'#13#10#13#10;               len:=Length(s); FN_WRITE(ecb.ConnID, PChar(s), len, 0);
  36.   repeat
  37.     s:='--TERM'#13#10;                                                                    len:=Length(s); FN_WRITE(ecb.ConnID, PChar(s), len, 0);
  38.     s:='Content-type: text/html'#13#10#13#10;                                             len:=Length(s); FN_WRITE(ecb.ConnID, PChar(s), len, 0);
  39.     s:='<title>ISAPI Generated Page (serverpush.dll)</title>'#13#10;                      len:=Length(s); FN_WRITE(ecb.ConnID, PChar(s), len, 0);
  40.     s:='<body><h1>Server Push Demo</h1>'#13#10;                                           len:=Length(s); FN_WRITE(ecb.ConnID, PChar(s), len, 0);
  41.     s:='<h3>'+FormatDateTime('ddd, dd mmm yyyy hh:nn:ss "GMT"', Now)+'</h3></body>'#13#10;len:=Length(s); FN_WRITE(ecb.ConnID, PChar(s), len, 0);
  42.     Sleep(1000);
  43.   until (FALSE) OR (len=0);
  44. end;
  45.  
  46. // * REQUIRED FOR DYNAMIC BINDING.
  47. // * Index values aren't need.
  48. // * Case doesn't matter here.
  49. exports
  50.   GetExtensionVersion,
  51.   HttpExtensionProc;
  52.   
  53. begin
  54. end.
  55.